<?php declare(strict_types=1);
/**
 * This file is part of Swoft.
 *
 * @link     https://swoft.org
 * @document https://swoft.org/docs
 * @contact  group@swoft.org
 * @license  https://github.com/swoft-cloud/swoft/blob/master/LICENSE
 */

namespace App\Http\Controller;

use Anno\Mapping\Controller;
use Anno\Mapping\RequestMapping;
use Swoft\Bean\Annotation\Mapping\Inject;
use Swoft\View\Annotation\Mapping\View;

/**
 * Class HomeController
 * @Controller("/home")
 */
class HomeController
{
    /**
     * 还可以通过Inject这种方式来注入一个类，下面这样写之后就会把view类注入到$view中，同样也可以注入其他类
     * @Inject("view")
     * @var \view
     */
    protected $view;

    /**
     * @RequestMapping("/index")
     * @View("home/index")#另一个注解，注解可以有多个
     * @throws Throwable
     */
    public function index()
    {
          echo 'home-index'.PHP_EOL;
          return 'anno index';
    }
}
